const {
    Schema,
    model
} = require('mongoose');

const usersSchema = new Schema({
    userName: String,
    password: String,
    nickName: String,
    phone: String,
    wallet: {
        type: Number,
        default: 0,
    },
    score: {
        type: Number,
        default: 0,
    },
    userType: {
        type: Number,
        default: 0,
    },
    salesmanId: {
        type: Schema.Types.ObjectId, // mongoose 中 _id 属性的类型
        ref: 'Salesmans' // 指定关联集合的模型名称
    },
    phone: String,
}, {
    versionKey: false
});

const Users = model('Users', usersSchema, 'users');
module.exports.Users = Users;